const express = require('express') // 项目使用一个插件
const app = express() // 实例化一个服务器的应用
const ejs = require('ejs')
const bodyParser = require('body-parser')
const session = require('express-session')
    /* 引入静态路由配置 */
const StaticRouter = require('./controller/staticRouter')
const ActiveRouter = require('./controller/activeRouter')

/* static Page setting */
app.set('view engine', 'ejs');
app.use(express.static('static'))

/*  body-parser session */
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: false }))
app.use(session({
    secret: 'keyboard cat',
    resave: false,
    saveUninitialized: true
}))

app.use('/', StaticRouter)
app.use('/api', ActiveRouter)


app.listen(3001)